@import '../global/variables.css';

:root,
:host {
  --ring-progress-bar-background-color: rgba(0, 0, 0, 0.2);
  --ring-progress-bar-line-background-color: rgba(255, 255, 255, 0.6);
}

:global(.ring-ui-theme-dark) {
  --ring-progress-bar-background-color: rgba(255, 255, 255, 0.3);
  --ring-progress-bar-line-background-color: rgba(255, 255, 255, 0.4);
}

.progressBar {
  position: relative;
  z-index: 1; /* Required to see border-radius on animated background */

  overflow: hidden;

  height: calc(var(--ring-unit) / 2);
  margin-bottom: calc(var(--ring-unit) / 2);

  border-radius: 2px;
  background-color: var(--ring-progress-bar-background-color);
}

.globalMode {
  position: absolute;
  top: 0;

  width: 100%;

  background: transparent;
}

.line {
  float: left;

  width: 0;
  height: 100%;

  transition: width 0.6s ease;
  text-align: center;

  color: var(--ring-content-background-color);
  border-radius: 2px;
  background-color: var(--ring-main-color);

  line-height: calc(var(--ring-unit) / 2);

  &::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;

    content: '';
    animation: progress-bar-animation 2500ms linear infinite;

    background-image: linear-gradient(to right,
    rgba(0, 0, 0, 0),
    var(--ring-progress-bar-line-background-color),
    rgba(0, 0, 0, 0));
    background-repeat: no-repeat;
  }

  .staticLineColor &::after {
    animation: none;

    background-image: var(--ring-progress-bar-line-background-color);
  }
}

@keyframes progress-bar-animation {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(100%);
  }
}
